<!-- 会员订单表表单弹窗 -->
<form id="order-form" lay-filter="order-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">订单编号</label>
        <div class="layui-input-block">
            <input name="orderNo" placeholder="请输入订单编号" type="text" class="layui-input" maxlength="20"  id="orderNo"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">商家名称</label>
        <div class="layui-input-block">
            <input name="businessId" placeholder="请输入商家ID" type="text" class="layui-input" maxlength="20"  id="businessId"
                   lay-verify="required" style="display:none" required/>
            <input name="businessName" placeholder="请输入商家名称" type="text" class="layui-input" maxlength="20"  id="businessName">
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">会员ID</label>
        <div class="layui-input-block">
            <input name="memberId" placeholder="请输入会员ID" type="text" class="layui-input" maxlength="20"  id="memberId"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">订单状态</label>
        <div class="layui-input-block">
            <!--<input name="status" placeholder="请输入订单状态 -1-已取消,-2-申请退款，-3-已退款，0-待付款,1-服务中，2-待评价，3-已完成" type="text" class="layui-input" maxlength="20"  id="status"-->
                   <!--lay-verify="required" required/>-->
            <select name="status">
                <option value="-1">已取消</option>
                <option value="-2">申请退款</option>
                <option value="-3">已退款</option>
                <option value="0">待付款</option>
                <option value="1">服务中</option>
                <option value="2">待评价</option>
                <option value="3">已完成</option>
                <option value="4">待抢单</option>
            </select>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">订单类型</label>
        <div class="layui-input-block">
            <input name="serviceType" placeholder="请输入订单类型，1-咨询订单，2-闪测订单，3-提问订单，4-充值订单" type="text" class="layui-input" maxlength="20"  id="serviceType"
                   lay-verify="required" style="display: none" required/>
            <input name="strServiceType" type="text" class="layui-input" maxlength="20"  id="strServiceType"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">大师名称</label>
        <div class="layui-input-block">
            <input name="teacherId" placeholder="请输入大师ID" type="text" class="layui-input" maxlength="20"  id="teacherId"
                   lay-verify="required" style="display: none" required/>
            <input name="teacherName" type="text" class="layui-input" maxlength="20"  id="teacherName"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">订单金额</label>
        <div class="layui-input-block">
            <input name="totalAmount" placeholder="请输入订单金额" type="text" class="layui-input" maxlength="20"  id="totalAmount" readonly
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">下单时间</label>
        <div class="layui-input-block">
            <!--<input name="createDate" placeholder="请输入下单时间" type="text" class="layui-input" maxlength="20"  id="createDate"-->
                   <!--lay-verify="required" required/>-->
            <label class="layui-form-label" style="width: 180px;text-align: left;" name="createDate"  id="createDate"></label>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <!--<button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>-->
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var order = admin.getTempData('t_order');
           if (order.method=="update"){
               console.log("order detail:");
               console.log(order)
               //显示订单类型
               if(order.serviceType==1){
                   $("#strServiceType").val("咨询订单");
               }else if(order.serviceType==2){
                   $("#strServiceType").val("闪测订单");
               }else if(order.serviceType==3){
                   $("#strServiceType").val("提问订单");
               }else if(order.serviceType==4){
                   $("#strServiceType").val("充值订单");
               }else if(order.serviceType==5){
                   $("#strServiceType").val("VIP认证");
               }
               $("#createDate").text(order.createDate);
        	form.val('order-form', order);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('order/order/'+order.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
